Multi-threshold segmentation method for medical images based on improved salp swarm algorithm

ABSTRACT

The invention discloses a multi-threshold segmentation method for medical images based on an improved salp swarm algorithm. A two-dimensional histogram is established by means of a grayscale image of a medical image and a non-local mean image, then a salp swarm algorithm is used to determine thresholds selected by a Kapur entropy-based threshold method, and the salp swarm algorithm is improved and mutated by an individual-linked mutation strategy during the threshold selection process to avoid local optimization, so that the segmentation effect on the medical image is optimized; and the method has the advantages of good robustness and high accuracy.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of China application serialno. 202110794722.9, filed on Jul. 14, 2021. The entirety of theabove-mentioned patent application is hereby incorporated by referenceherein and made a part of this specification.

TECHNICAL FIELD

The invention relates to a multi-threshold segmentation method formedical images, in particular to a multi-threshold segmentation methodfor medical images based on an improved salp swarm algorithm.

DESCRIPTION OF RELATED ART

Image segmentation, as the key technology of image pre-processing, is acritical step from image processing to image analysis and is also adifficulty in computer vision, image analysis, and image understanding.Medical image segmentation, as an important application field of medicalimage processing, can assist doctors in making therapeutic schemes,locating pathological tissue regions, and studying anatomical tissues.However, with the continuous development of medical imaging equipmentand imaging technologies, doctors have to devote a huge amount of timeand energy to interpret medical images one by one, and correct diagnosisand treatment of patent's conditions by doctors may be affected by theambient temperature, signal interference, and the uncertainty andcomplexity of pathological tissue regions during the image acquisitionprocess.

The threshold-based image segmentation method is easy to implement,small in computation and stable in performance, thus having become themost basic and most widely used image segmentation technique at present.The key to the threshold-based image segmentation method is thedetermination of thresholds. At present, common methods for selectingthresholds include a peak-valley method based on image grayscalehistograms, a minimum error method, a transition region-based method,and a maximum entropy-based threshold method. The peak-valley methodbased on image grayscale histograms has an obvious effect on asingle-target or obviously-distinctive images, but has an unsatisfyingeffect on multi-target images. The minimum error method is relativelycomplex and difficult to implement. The OTSU method has the defect thatunacceptable large black regions may appear and even information of awhole image may be lost when the grayscale difference between a targetand a background is not obvious, and this method is extremely sensitiveto noise and the size of the target. The maximum entropy (Kapurentropy)-based threshold method can select features flexibly, so usersdo not need to spend their energy in considering how to use the featuresin images. However, traditional Kapur entropy-based threshold methodsresolve thresholds by an exhaustion method, which may encounter theproblem of “exponential explosion”, thus causing an extremely lowoperating rate when a multi-threshold task is performed, wasting toomuch time, and failing to meet application requirements. Nowadays,optimization algorithms have been used to search for thresholds togetherwith the Kapur entropy-based threshold methods, but most optimizationalgorithms have the defect of low convergence rate and localoptimization. The salp swarm algorithm (SSA), as a novel metaheuristicoptimization algorithm, is enlightened by the salp foraging process,which includes three stages of approaching food, wrapping food, andsearching for food, and can continuously explore and develop a wholesearch space. However, the SSA also has the defects of localoptimization and premature convergence in the search process, thusreducing the accuracy of threshold-based image segmentation.

BRIEF SUMMARY OF THE INVENTION

The technical issue to be settled by the invention is to provide amulti-threshold segmentation method for medical images based on animproved salp swarm algorithm, which has good robustness and highaccuracy. The multi-threshold segmentation method for medical imagesuses the salp swarm algorithm to determine thresholds selected by aKapur entropy-based threshold method, and the salp swarm algorithm isimproved and mutated by an individual-linked mutation strategy in thethreshold selection process to avoid local optimization to optimize thesegmentation effect of medical images.

The technical solution adopted by the invention to settle the aforesaidtechnical issues is as follows: a multi-threshold segmentation methodfor medical images based on an improved salp swarm algorithm comprisesthe following steps:

S1: marking a to-be-segmented medical image as I, marking the size ofthe to-be-segmented medical image as m×n, marking a pixel in the ith rowand jth column of the medical image I as (i,j), marking a grayscale ofthe pixel (i,j) in the medical image I as a_(i,j), and setting thenumber of thresholds for segmenting the medical image as L=20, whereini=1, 2, . . . , m, and j=1, 2, . . . , n.

S2: performing non-local mean filtering on the medical image I to obtaina non-local mean image with the size of m×n, marking a pixel in thei^(th) row and j^(th) column of the non-local mean image as(i_(n),j_(n)), and marking a grayscale of the pixel (i_(n),j_(n)) in thenon-local mean image as b wherein i_(n)−1, 2, . . . , m, and j_(n)=1, 2,. . . , n.

The pixel in the i^(th) row and j^(th) column of the medical image Icorresponds to the pixel in the i^(th) row and j^(th) column of thenon-local mean image, and the two pixels constitute a pixel pair; themedical image I corresponds to the non-local mean image to form m×npixel pairs; the grayscales of the two pixels of each pixel pairconstitute a grayscale pair, so that m×n grayscale pairs are obtained; atwo-dimensional histogram is established with the grayscales of thepixels of the medical image I as an x-axis and the grayscales of thepixels of the non-local mean image as a y-axis, wherein coordinates ofthe (i×j)^(th) grayscale pair is (a_(i,j), b_(i) _(n) _(,j) _(n) ), thatis x=a_(i,j), y=b_(i) _(n) _(,j) _(n) , and the number of times ofappearance of the coordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of thegrayscale pair in coordinates of the (i×j) grayscale pairs is marked asf_(i,j), so that the numbers of times of appearance f_(1,1)˜f_(m,n) ofthe coordinates (a_(1,1), b₁ _(n) _(,1) _(n) ) of the first grayscalepair to the coordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of the(i×j)^(th) grayscale pair in the coordinates of the (i×j) grayscalepairs are obtained; a joint probability density of the grayscale a_(i,j)of the pixel (i,j) in the medical image I and the grayscale b_(i) _(n)_(,j) _(n) of the pixel (i_(n),j_(n)) in the non-local mean value imageis marked as p(a_(i,j), b_(i) _(n) _(,j) _(n) ), wherein p(a_(i,j),b_(i) _(n) _(,j) _(n) ) is calculated according to formula (1):

$\begin{matrix}{{p\left( {a_{i,j},b_{i_{n},j_{n}}} \right)} = \frac{f_{i,j}}{m \times n}} & (1)\end{matrix}$

S3: segmenting the medical image by an improved salp swarm algorithm,specifically as follows:

S3.1: defining a mother salp population and two filial salp populationsX¹ and X², wherein population sizes of the mother salp population andthe two filial salp populations X¹ and X² are all M=30, that is, themother salp population includes M individuals, and each filial salppopulation includes M individuals; each individual in the two filialsalp populations is represented by a data matrix constituted by dim=Ldimension values in one row and dim columns, each individual in themother salp population is represented by a data matrix constituted by2dim=L dimension values in one row and 2dim columns, and the datamatrices are called dimension matrices; a lower boundary matrix of themother salp population is set as lb, and an upper boundary matrix of themother salp population is set as ub, wherein, lb is a matrix [0, 0, 0, .. . , 0] including one row and 2dim columns, ub is a matrix [254, 254,254, . . . , 254] including one row and 2dim columns, lb_(D) representsthe D^(th) element in the lower boundary matrix lb, ub_(D) representsthe D^(th) element in the upper boundary matrix ub, and D=1, 2, . . . ,2dim.

S3.2: initializing the filial salp population X¹ and the filial salppopulation X² respectively to obtain 0-generation filial salppopulations X^(1,0) and X^(2,0) specifically as follows:

S3.2.1: assigning each individual in the filial salp population X¹ andeach individual in the filial salp population X² respectively accordingto formula (2) and formula (3):

X _(l,d) ¹=rand *(ub _(d) −lb _(d))+lb _(d)  (2)

X _(l,d) ²=rand *(ub _(d) −lb _(d))+lb _(d)  (3)

Wherein, lb_(d) represents the d^(th) element in the lower boundarymatrix lb, ub_(d) represents the d^(th) element in the upper boundarymatrix ub, and d=1, 2, . . . , dim; X_(d) represents the d^(th)dimension value of the l^(th) individual in the filial salp populationX¹, X_(l,d) ² represents the d^(th) dimension value of the l^(th)individual in the filial salp population X², and l=1, 2, . . . , 30;rand represents a random number between 0 and 1 generated by a randomfunction, and rand is regenerated by the random function before eachcalculation performed according to formula (2) and formula (3);

S3.2.2: rearranging the dimensional values of each assigned individualin the filial salp population X¹ in an increasing order to obtain a0-generation salp population X^(1,0), marking the d^(th) dimension valueof the l^(th) individual in the 0-generation salp population X^(1,0), asX_(l,d) ^(1,0), rearranging the dimensional values of each assignedindividual in the filial salp population X² in an increasing order toobtain a 0-generation salp population X^(2,0), marking the d^(th)dimension value of the l^(th) individual in the 0-generation salppopulation X^(2,0) as X_(l,d) ^(2,0).

S3.3: setting a global optimum fitness value best, initially assigningbest with a minus infinity, setting a global optimum individualbestposition, and initially setting bestposition as a matrix [0, 0, 0, .. . , 0] including one row and 2dim columns.

S3.4: setting a maximum number of iterations of the mother salppopulation as T=100, setting an iteration variable t, and initiallysetting t as 1.

S3.5: performing a t^(th) iteration on the mother salp population,specifically as follows:

S3.5.1: setting two threshold vectors h^(l,t) ∧s^(l,t) capable ofstoring one row and (L−1) columns of data, rounding off the firstdimension value to the (L−1)^(th) dimension value of the l^(th)individual in the (t−1)^(th)-generation filial salp population X^(1,t−1)to obtain integers which are put into h^(l,t), and marking H^(th) datain h^(l,t) as h_(H) ^(l,t), wherein H=1, 2, . . . , (L−1); rounding offthe first dimension value to the (L−1)^(th) dimension value of thel^(th) individual in the (t−1)^(th)-generation filial salp populationX^(2,t−1) to obtain integers which are put into s^(l,t), and markingH^(th) data in s^(l,t) as s_(H) ^(l,t) and constituting a thresholdvector (h_(H) ^(l,t), s_(H) ^(l,t)) by h_(H) ^(l,t) and s_(H) ^(l,t), sothat (L−1) pairs of threshold vectors are obtained; segmenting themedical image I into L regions, which are [0,h₁ ^(l,t), [h₁ ^(l,t), h₂^(l,t), . . . , [h_(L−1) ^(l,t), h_(L−1) ^(l,t) and [h_(L−1) ^(l,t),255respectively, according to h^(l,t) pairs of grayscales of the medicalimage I in the two-dimensional histogram, wherein [represents theinclusion of a lower boundary, and the exclusion of an upper boundary;segmenting the medical image I into L regions, which are [0,s₁ ^(l,t),s₁ ^(l,t),s₂ ^(l,t), . . . , [s_(L−2) ^(l,t),s_(L−1) ^(l,t) and [s_(L−1)^(l,t),255 respectively, according to s^(l,t) pairs of grayscales of themedical image I in the two-dimensional histogram, forming L grayscalepair segmentation regions {N₁, N₂ . . . N_(L)} by the L regions obtainedby segmentation according to the grayscales of the medical image I inthe two-dimensional histogram and L regions obtained by segmentationaccording to grayscales of the non-local mean image in thetwo-dimensional histogram, representing the probability of appearance ofthe kth grayscale pair segmentation region N_(k) by I_(N) _(k) (h_(k)^(l,t),s_(k) ^(l,t)), and marking a Kapur entropy of the current kthgrayscale pair segmentation region N_(k) as K_(N) _(k) ^(t)(h_(k)^(l,t),s_(k) ^(l,t)), wherein k=1, 2, . . . , (L−1), and the Kapurentropy K_(N) _(k) ^(t)(h_(k) ^(l,t),s_(k) ^(l,t)) is expressed byformula (4):

$\begin{matrix}\left\{ \begin{matrix}{{K_{N_{k}}^{t}\left( {h_{k}^{l,t},s_{k}^{l,t}} \right)} = {- {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{\frac{p\left( {g,b} \right)}{w_{L - 1}}\ln\frac{p\left( {g,b} \right)}{w_{L - 1}}}}}}} \\{w_{L - 1} = {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{p\left( {g,b} \right)}}}}\end{matrix} \right. & (4)\end{matrix}$

Wherein, when k=1, s₀ ^(l,t)=0, h₀ ^(l,t)=0, g is an integer, g=0, 1, .. . , h_(k) ^(l,t), b is an integer, and b=0, 1, . . . , s_(k) ^(l,t);and when the value of (g,b) is not within the m×n grayscale pairsobtained in S2, p(g,b)=0; In represents a natural logarithm.

S3.5.2: obtaining a (t−1)^(th) mother salp population Y^(t−1) by usingthe dimension values of one row and dim columns of the l^(th) individualof the (t−1)^(th)-generation filial salp population X^(1,t−1) asdimension values from the first column to the dim^(th) column of thefirst row of the mother salp population and using the dimension valuesof one row and dim columns of the (t−1)^(th)-generation filial salppopulation X^(2,t−1) as dimension values from the (dim+1)^(th) column tothe 2dim^(th) column of the first row of the mother salp population, andmarking the D^(th) dimension value of the l^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) as Y_(l,D) ^(t−1), whereinD=1, 2, . . . , 2dim.

S3.5.3: setting an objective function of the l^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) as R^(l,t−1){(h₁ ^(l,t),s₁^(l,t)),(h₂ ^(l,t),s₂ ^(l,t)), . . . (h_(L−1) ^(l,t),s_(L−1) ^(l,t))},and expressing the objective function by formula (5):

$\begin{matrix}{{R^{l,{t - 1}}\left\{ {\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right),\ \left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right),{\ldots\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}} \right\}} = {{K_{N_{1}}^{t}\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right)} + {K_{N_{2}}^{t}\left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right)} + \ldots + {K_{N_{L - 1}}^{t}\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}}} & (5)\end{matrix}$

S3.5.4: substituting the Kapur entropy K_(N) _(k) (h_(k) ^(l,t),s_(k)^(l,t)) of the current kth grayscale pair segmentation region N_(k)obtained by calculation into the objective function of the l^(th)individual in the (t−1)^(th) mother salp population Y^(t−1) to obtain anobjective function value of the l^(th) individual in the (t−1)^(th)mother salp population Y^(t−1) by calculation, and using the objectivefunction value as a fitness value fitness (l)^(t−1) of the l^(th)individual in the (t−1)^(th) mother salp population Y^(t−1), so that thefitness values of M individuals in the (t−1)^(th) mother salp populationY^(t−1) are obtained by calculation.

S3.5.5: rearranging the fitness values of the M individuals in the(t−1)^(th) mother salp population Y^(t−1) in an increasing order,marking a maximum fitness value of the (t−1)^(th) mother salp populationY^(t−1) as bF^(t−1), marking a minimum fitness value of the (t−1)^(th)mother salp population Y^(t−1) as wF^(t−1), marking the individualcorresponding to the maximum fitness value as bP^(t−1), and using theindividual corresponding to the maximum fitness value as an optimumindividual of the (t−1)^(th) mother salp population Y^(t−1).

S3.5.6: updating the first individual to the (M/2)^(th) individual inthe (t−1)^(th) mother salp population Y^(t−1) according to formula (6)to obtain a first individual to an (M/2)^(th) individual in at^(th)-generation initial mother salp population F^(t):

$\begin{matrix}{F_{l,D}^{t} = \left\{ \begin{matrix}{{{bP_{D}^{t - 1}} + {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} \geq 0} \\{{{bP_{D}^{t - 1}} - {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} < 0}\end{matrix} \right.} & (6)\end{matrix}$ $\begin{matrix}{c^{t} = {2e^{- {(\frac{4*t}{T})}^{2}}}} & (7)\end{matrix}$

Wherein, r1^(t) and r2^(t) represent random numbers between 0 and 1generated by a random function, c^(t) is a control parameter and isexpressed by formula (7), bP_(D) ^(t−1) represents the D^(th) dimensionvalue of the optimum individual of the (t−1)^(th) mother salp populationY^(t−1), F_(l,D) ^(t) represents the D^(th) dimension value of thel^(th) individual in the t^(th)-generation initial mother salppopulation F^(t), ub_(D) and lb_(D) represent the D^(th) dimension valueof an upper boundary and the D^(th) dimension value of a lower boundary,and e is a natural constant.

S3.5.7: updating the (M/2)^(th) individual to the M^(th) individual inthe (t−1)^(th) mother salp population Y^(t−1) according to formula (8)to obtain the (M/2)^(th) individual to the M^(th) individual in thet^(th)-generation initial mother salp population F^(t):

F _(l) ^(t)=½(Y _(l) ^(t−1) +Y _(l−1) ^(t−1))  (8)

Wherein, Y_(l) ^(t−1) represents the l^(th) individual in the (t−1)^(th)mother salp population Y^(t−1), Y_(l−1) ^(t−1) represents the (l−1)^(th)individual in the (t−1)^(th) mother salp population Y^(t−1), and F_(l)represents the l^(th) individual in the t^(th)-generation initial mothersalp population F^(t).

S3.5.8: developing and exploring the t^(th)-generation initial mothersalp population F^(t) according to formulas (9)-(12) to obtain at^(th)-generation intermediate mother salp population G^(t):

$\begin{matrix}\left\{ \begin{matrix}{\begin{matrix}{{G_{l}^{t} = {F_{A}^{t} - {r3^{t} \times {Levy}^{t} \times \left( {F_{B}^{t} - F_{C}^{t}} \right)}}},} & {\theta < 0}\end{matrix}\ } \\{\begin{matrix}{{G_{l}^{t} = {F_{D}^{t} - {r4^{t} \times {❘{F_{D}^{t} - {2r5^{t} \times F_{l}^{t}}}❘}}}},} & {\theta \geq {0\cap r7^{t}} < {0.5}}\end{matrix}\ } \\{\begin{matrix}\begin{matrix}{{G_{l}^{t} = {\left( {{bP^{t - 1}} - {{mean}\left( F^{t} \right)}} \right) - {r4^{t} \times}}}\ ,} \\\left( {{\left( {{ub} - {lb}} \right) \times r6^{t}} + {lb}} \right)\end{matrix} & {\theta \geq {0\cap r7^{t}} \geq {0.5}}\end{matrix}\ }\end{matrix} \right. & (9)\end{matrix}$ $\begin{matrix}{{Levy}^{t} \sim \frac{\varphi \times \mu^{t}}{{❘v^{t}❘}^{1/\delta}}} & (10)\end{matrix}$ $\begin{matrix}{\varphi = \left\lbrack \frac{{\Gamma\left( {1 + \delta} \right)} \times {\sin\left( {\pi \times {\delta/2}} \right)}}{\Gamma\left( {\left( \frac{\delta + 1}{2} \right) \times \delta \times 2^{{({\delta - 1})}/2}} \right)} \right\rbrack^{1/\delta}} & (11)\end{matrix}$ $\begin{matrix}{\theta = {{\tan\left( {{pi} \times \left( {{r8^{t}} - {0.5}} \right)} \right)} - \left( {1 - {t/T}} \right)}} & (12)\end{matrix}$

Wherein, G_(l) ^(t) represents the l^(th) individual in thet^(th)-generation intermediate mother salp population G^(t) generatedafter updating, Levy^(t) is a step parameter and is expressed byformulas (10)-(11), F_(A) ^(t), F_(B) ^(t), F_(C) ^(t) and F_(D) ^(t)represent four non-repetitive individuals A, B, C and D randomlyselected from in the t^(th)-generation initial mother salp populationF^(t), r3^(t), r4^(t), r5^(t), r6^(t), r7^(t) and r8^(t) are randomnumbers between 0 and 1 generated by a random function, and μ^(t) is arandom number between 0 and 1 generated by a random function, v^(t) is arandom number following normal distribution and is between 0 and 1, δ isa constant and is set as 1.5, Γ is a standard gamma function, θ is aprobability selection coefficient and is expressed by formula (12), piis π, mean(F^(t)) represents a mean value of the dimension values of theM individuals in the t^(th)-generation initial mother salp populationF^(t), tan represents a tangent function, and sin represents a sinefunction.

S3.5.9: obtaining two initial filial salp populations by using adimension matrix constituted by dimension values of the first column tothe dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as an l^(th)individual of one initial filial salp population and using a dimensionmatrix constituted by dimension values of the (dim+1)^(th) column to the2dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as a l^(th)individual of the other initial filial salp population, and obtainingfitness values of the M individuals in the t^(th)-generation initialmother salp population F^(t) by calculation through a method the same asStep 3.5.1-Step 3.5.4.

Obtaining two intermediate filial salp populations by using a dimensionmatrix constituted by dimension values of the first column to thedim^(th) column of the first row of the l^(th) individual in thet^(th)-generation intermediate mother salp population G^(t) as a l^(th)individual of one intermediate filial salp population and using adimension matrix constituted by dimension values of the (dim+1)^(th)column to the 2dim^(th) column of the first row of the l^(th) individualin the t¹th-generation intermediate mother salp population G^(t) as al^(th) individual of the other intermediate filial salp population, andobtaining fitness values of the M individuals in the t^(th)-generationintermediate mother salp population G^(t) by calculation through amethod the same as Step 3.5.1-Step 3.5.4.

Rearranging the 2 M individuals, including the M individuals in thet^(th)-generation initial mother salp population F^(t) and the Mindividuals in the t^(th)-generation intermediate mother salp populationG^(t), in an increasing order according to the fitness values of the 2 Mindividuals, selecting M individuals with larger fitness values, andrandomly arranging the M selected individuals to form a new population.

Comparing a maximum fitness value of the new population with the globaloptimum fitness value best; if the maximum fitness value of the newpopulation is greater than the global optimum fitness value best,updating the global optimum fitness value best with the maximum fitnessvalue, and using the individual corresponding to the maximum fitnessvalue as the global optimum individual bestposition; or, if the maximumfitness value of the new population is not greater than the globaloptimum fitness value best, keeping the global optimum fitness valuebest and the global optimum individual bestposition unchanged.

Obtaining two t^(th)-generation filial salp populations X^(1,t) andX^(2,t) by using a dimension matrix constituted by dimension values ofthe first column to the dim^(th) column of the first row of the l^(th)individual in the new population as a l^(th) individual of thet^(th)-generation filial salp population X^(1,t) and using a dimensionmatrix constituted by dimension values of the (dim+1)^(th) column to the2dim^(th) column of the first row of the l^(th) individual in the newpopulations a l^(th) individual of the t^(th)-generation filial salppopulation X^(2,t), and ending the t^(th) iteration.

S6: determining whether a current value of t is equal to T; if not,updating the value of t with the sum of the current value of t and 1,and then returning to S3.5.1 to perform a next iteration; if so, endingthe iteration process, using the first dimension value to the dim^(th)dimension value of the current global optimum individual bestposition asL thresholds for Renyi entropy-based multi-threshold segmentation of themedical image; arranging the L thresholds in an increasing order, andthen marking the L thresholds as Th₁, Th₂, Th₃, . . . , Th_(dim);setting (L+1) segmentation intervals [0, Th₁), [Th₁, Th₂), [Th₂, Th₃), .. . , [Th_(dim), 255], determining the segmentation interval into whichthe grayscale of each pixel of the medical image I falls, amending thegrayscale of the pixel to a lower boundary of the correspondingsegmentation interval into which the pixels falls, obtaining asegmentation grayscale map based on the amended grayscales of the pixelsof the medical image I after all grayscales of all the pixels of themedical image I are amended, and obtaining a finally segmented medicalimage according to the segmentation grayscale map.

Compared with the prior art, the invention has the following advantages:a two-dimensional histogram is established by means of a grayscale imageof a medical image and a non-local mean image, then an optimumsegmentation threshold is selected by an improved salp swarm algorithmwith the Renyi entropy as the fitness, and the salp swarm algorithm isimproved and mutated by an individual-linked mutation strategy duringthe threshold selection process to obtain different populations to avoidlocal optimization, so that the segmentation effect on the medical imageis optimized, local optimization is avoided, and the method has goodrobustness and high accuracy.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a grayscale image of a medical image I in Step S1 of amulti-threshold segmentation method for medical images based on animproved salp swarm algorithm according to the invention.

FIG. 2 is a two-dimensional histogram generated by a non-local meanimage and a grayscale image of the medical image I in Step 2 of themulti-threshold segmentation method for medical images based on animproved salp swarm algorithm according to the invention.

FIG. 3 is a threshold segmentation region chart generated by thenon-local mean image and the grayscale image in Step S3.5.1 of themulti-threshold segmentation method for medical images based on animproved salp swarm algorithm according to the invention.

FIG. 4 is a grayscale map of medical image segmentation in Step S6 ofmulti-threshold segmentation method for medical images based on animproved salp swarm algorithm according to the invention.

DETAILED DESCRIPTION OF THE INVENTION

The invention will be described in further detail below in conjunctionwith the accompanying drawings and embodiments.

Embodiment 1: a multi-threshold segmentation method for medical imagesbased on an improved salp swarm algorithm comprises the following steps:

S1: a to-be-segmented medical image is marked as I, the size of theto-be-segmented medical image is marked as m×n, a pixel in the i^(th)row and j^(th) column of the medical image I is marked as (i,j), agrayscale of the pixel (i,j) in the medical image I is marked asa_(i,j),and the number of thresholds for segmenting the medical image is set asL=20, wherein i=1, 2, . . . , m, and j=1, 2, . . . , n; a grayscaleimage of the medical image I is shown in FIG. 1 .

S2: non-local mean filtering is performed on the medical image I toobtain a non-local mean image with the size of m×n, a pixel in thei^(th) row and j^(th) column of the non-local mean image is marked as(i_(n),j_(n)), and a grayscale of the pixel (i_(n),j_(n)) in thenon-local mean image is marked as b_(i) _(n) _(,j) _(n) , whereini_(n)−1, 2, . . . , m, and j_(n)=1, 2, . . . , n.

The pixel in the i^(th) row and j^(th) column of the medical image Icorresponds to the pixel in the i^(th) row and j^(th) column of thenon-local mean image, and the two pixels constitute a pixel pair; themedical image I corresponds to the non-local mean image to form m×npixel pairs; the grayscales of the two pixels of each pixel pairconstitute a grayscale pair, so that m×n grayscale pairs are obtained; atwo-dimensional histogram is established with the grayscales of thepixels of the medical image I as an x-axis and the grayscales of thepixels of the non-local mean image as a y-axis, and the two-dimensionalhistogram is shown in FIG. 2 , wherein coordinates of the (i×j)^(th)grayscale pair are (a_(i,j), b_(i) _(n) _(,j) _(n) ), that is x=a_(i,j),y=b_(i) _(n) _(,j) _(n) , and the number of times of appearance of thecoordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of the grayscale pair incoordinates of the (i×j) grayscale pairs is marked as f_(i,j), so thatthe numbers of times of appearance f_(1,1)˜f_(m,n) of the coordinates(a_(1,1),b₁ _(n) _(,1) _(n) ) of the first grayscale pair to thecoordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of the (i×j)^(th)grayscale pair in the coordinates of the (i×j) grayscale pairs areobtained; a joint probability density of the grayscale a_(i,j) of thepixel (i,j) in the medical image I and the grayscale b_(i) _(n) _(,j)_(n) of the pixel (i_(n),j_(n)) in the non-local mean value image ismarked as p(a_(i,j), b_(i) _(n) _(,j) _(n) ), wherein p(a_(i,j), b_(i)_(n) _(,j) _(n) ) is calculated according to formula (1):

$\begin{matrix}{{p\left( {a_{i,j},b_{i_{n},j_{n}}} \right)} = \frac{f_{i,j}}{m \times n}} & (1)\end{matrix}$

S3: the medical image is segmented by an improved salp swarm algorithm,specifically as follows:

S3.1: a mother salp population and two filial salp populations X¹ and X²are defined, wherein population sizes of the mother salp population andthe two filial salp populations X¹ and X² are all M=30, that is, themother salp population includes M individuals, and each filial salppopulation includes M individuals; each individual in the two filialsalp populations is represented by a data matrix constituted by dim=Ldimension values in one row and dim columns, each individual in themother salp population is represented by a data matrix constituted by2dim=L dimension values in one row and 2dim columns, and the datamatrices are called dimension matrices; a lower boundary matrix of themother salp population is set as lb, and an upper boundary matrix of themother salp population is set as ub, wherein, lb is a matrix [0, 0, 0, .. . , 0] including one row and 2dim columns, ub is a matrix [254, 254,254, . . . , 254] including one row and 2dim columns, lb_(D) representsthe D^(th) element in the lower boundary matrix lb, ub_(D) representsthe D^(th) element in the upper boundary matrix ub, and D=1, 2, . . . ,2dim.

S3.2: the filial salp population X¹ and the filial salp population X²are initialized respectively to obtain 0-generation filial salppopulations X^(1,0) and X^(2,0), specifically as follows:

S3.2.1: each individual in the filial salp population X¹ and eachindividual in the filial salp population X² are assigned respectivelyaccording to formula (2) and formula (3):

X _(l,d) ¹=rand *(ub _(d) −lb _(d))+lb _(d)  (2)

X _(l,d) ²=rand *(ub _(d) −lb _(d))+lb _(d)  (3)

Wherein, lb_(d) represents the d^(th) element in the lower boundarymatrix lb, ub_(d) represents the d^(th) element in the upper boundarymatrix ub, and d=1, 2, . . . , dim; X_(l,d) ¹ represents the d^(th)dimension value of the l^(th) individual in the filial salp populationX¹, X_(l,d) ² represents the d^(th) dimension value of the l^(th)individual in the filial salp population X², and l=1, 2, . . . , 30;rand represents a random number between 0 and 1 generated by a randomfunction, and rand is regenerated by the random function before eachcalculation performed according to formula (2) and formula (3).

S3.2.2: the dimensional values of each assigned individual in the filialsalp population X¹ are rearranged in an increasing order to obtain a0-generation salp population X^(1,0), the d^(th) dimension value of thel^(th) individual in the 0-generation salp population X^(1,0) is markedas X_(l,d) ^(1,0), the dimensional values of each assigned individual inthe filial salp population X² are rearranged in an increasing order toobtain a 0-generation salp population X^(2,0), the d^(th) dimensionvalue of the l^(th) individual in the 0-generation salp populationX^(2,0) is marked as X_(l,d) ^(2,0).

S3.3: a global optimum fitness value best is set, best is initiallyassigned with a minus infinity, a global optimum individual bestpositionis set, and bestposition is initially set as a matrix [0, 0, 0, . . . ,0] including one row and 2dim columns.

S3.4: a maximum number of iterations of the mother salp population isset as T=100, an iteration variable t is set, and t is initially set as1.

S3.5: a t^(th) iteration is performed on the mother salp population,specifically as follows:

S3.5.1: two threshold vectors h^(l,t) ∧s^(l,t) capable of storing onerow and (L−1) columns of data are set, the first dimension value to the(L−1)^(th) dimension value of the l^(th) individual in the(t−1)^(th)-generation filial salp population X^(1,t−1) are rounded offto obtain integers which are put into h^(l,t), and H^(th) data inh^(l,t) is marked as h_(H) ^(l,t), wherein H=1, 2, . . . , (L−1); thefirst dimension value to the (L−1)^(th) dimension value of the l^(th)individual in the (t−1)^(th)-generation filial salp population X^(2,t−1)are rounded off to obtain integers which are put into s^(l,t), andH^(th) data in s^(l,t) is marked as s_(H) ^(l,t), and a threshold vector(h_(H) ^(l,t),s_(H) ^(l,t)) is constituted by h_(H) ^(l,t) and s_(H)^(l,t), so that (L−1) pairs of threshold vectors are obtained; themedical image I is segmented into L regions, which are [0,h₁ ^(l,t), [h₁^(l,t), h₂ ^(l,t), . . . , [h_(L−1) ^(l,t), h_(L−1) ^(l,t) and [h_(L−1)^(l,t),255 respectively, according to h^(l,t) pairs of grayscales of themedical image I in the two-dimensional histogram, wherein [representsthe inclusion of a lower boundary, and the exclusion of an upperboundary; segmenting the medical image I into L regions, which are [0,s₁^(l,t), [s₁ ^(l,t),s₂ ^(l,t), . . . , [s_(L−2) ^(l,t),s_(L−1) ^(l,t) and[s_(L−1) ^(l,t),255 respectively, according to s^(l,t) pairs ofgrayscales of the medical image I in the two-dimensional histogram,forming L grayscale pair segmentation regions {N₁, N₂ . . . N_(L)} bythe L regions obtained by segmentation according to the grayscales ofthe medical image I in the two-dimensional histogram and L regionsobtained by segmentation according to grayscales of the non-local meanimage in the two-dimensional histogram, as shown in FIG. 3 , theprobability of appearance of the kth grayscale pair segmentation regionN_(k) is represented by I_(N) _(k) (h_(k) ^(l,t),s_(k) ^(l,t)), and aKapur entropy of the current kth grayscale pair segmentation regionN_(k) is marked as K_(N) _(k) ^(t)(h_(k) ^(l,t),s_(k) ^(l,t)), whereink=1, 2, . . . , (L−1), and the Kapur entropy K_(N) _(k) ^(t)(h_(k)^(l,t),s_(k) ^(l,t)) is expressed by formula (4):

$\begin{matrix}\left\{ \begin{matrix}{{K_{N_{k}}^{t}\left( {h_{k}^{l,t},s_{k}^{l,t}} \right)} = {- {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{\frac{p\left( {g,b} \right)}{w_{L - 1}}\ln\frac{p\left( {g,b} \right)}{w_{L - 1}}}}}}} \\{w_{L - 1} = {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{p\left( {g,b} \right)}}}}\end{matrix} \right. & (4)\end{matrix}$

Wherein, when k=1, s₀ ^(l,t)=0, h₀ ^(l,t)=0, g is an integer, g=0, 1, .. . , h_(k) ^(l,t), b is an integer, and b=0, 1, . . . , s_(k) ^(l,t);and when the value of (g,b) is not within the m×n grayscale pairsobtained in S2, p(g,b)=0; In represents a natural logarithm.

S3.5.2: a (t−1)^(th) mother salp population Y^(t−1) is obtained by usingthe dimension values of one row and dim columns of the l^(th) individualof the (t−1)^(th)-generation filial salp population X¹,t−1 as dimensionvalues from the first column to the dim^(th) column of the first row ofthe mother salp population and using the dimension values of one row anddim columns of the (t−1)^(th)-generation filial salp populationX^(2,t−1) as dimension values from the (dim+1)^(th) column to the2dim^(th) column of the first row of the mother salp population, and theD^(th) dimension value of the l^(th) individual in the (t−1)^(th) mothersalp population Y^(t−1) is marked as Y_(l,D) ^(t−1), wherein D=1, 2, . .. , 2dim.

S3.5.3: an objective function of the l^(th) individual in the (t−1)^(th)mother salp population Y^(t−1) is set as R^(l,t−1){(h₁ ^(l,t),s₁^(l,t)),(h₂ ^(l,t),s₂ ^(l,t)), . . . (h_(L−1) ^(l,t),s_(L−1) ^(l,t))},and the objective function is expressed by formula (5):

$\begin{matrix}{{R^{l,{t - 1}}\left\{ {\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right),\ \left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right),{\ldots\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}} \right\}} = {{K_{N_{1}}^{t}\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right)} + {K_{N_{2}}^{t}\left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right)} + \ldots + {K_{N_{L - 1}}^{t}\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}}} & (5)\end{matrix}$

S3.5.4: the Kapur entropy K_(N) _(k) (h_(k) ^(l,t),s_(k) ^(l,t)) of thecurrent kth grayscale pair segmentation region N_(k) obtained bycalculation is substituted into the objective function of the l^(th)individual in the (t−1)^(th) mother salp population Y^(t−1) to obtain anobjective function value of the l^(th) individual in the (t−1)^(th)mother salp population Y^(t−1) by calculation, and the objectivefunction value is used as a fitness value fitness(l)^(t−1) of the l^(th)individual in the (t−1)^(th) mother salp population Y^(t−1), so that thefitness values of M individuals in the (t−1)^(th) mother salp populationY^(t−1) are obtained by calculation.

S3.5.5: the fitness values of the M individuals in the (t−1)^(th) mothersalp population Y^(t−1) are rearranged in an increasing order, a maximumfitness value of the (t−1)^(th) mother salp population Y^(t−1) is markedas bF^(t−1), a minimum fitness value of the (t−1)^(th) mother salppopulation Y^(t−1) is marked as wF^(t−1), the individual correspondingto the maximum fitness value is marked as bP^(t−1), and the individualcorresponding to the maximum fitness value is used as an optimumindividual of the (t−1)^(th) mother salp population Y^(t−1).

S3.5.6: the first individual to the (M/2)^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) are updated according toformula (6) to obtain a first individual to an (M/2)^(th) individual ina t^(th)-generation initial mother salp population F^(t):

$\begin{matrix}{F_{l,D}^{t} = \left\{ \begin{matrix}{{{bP_{D}^{t - 1}} + {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} \geq 0} \\{{{bP_{D}^{t - 1}} - {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} < 0}\end{matrix} \right.} & (6)\end{matrix}$ $\begin{matrix}{c^{t} = {2e^{- {(\frac{4*t}{T})}^{2}}}} & (7)\end{matrix}$

Wherein, r1^(t) and r2^(t) represent random numbers between 0 and 1generated by a random function, c^(t) is a control parameter and isexpressed by formula (7), bP_(D) ^(t−1) represents the D^(th) dimensionvalue of the optimum individual of the (t−1)^(th) mother salp populationY^(t−1), F_(l,D) ^(t) represents the D^(th) dimension value of thel^(th) individual in the t^(th)-generation initial mother salppopulation F^(t), ub_(D) and lb_(D) represent the D^(th) dimension valueof an upper boundary and the D^(th) dimension value of a lower boundary,and e is a natural constant.

S3.5.7: the (M/2)^(th) individual to the M^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) are updated according toformula (8) to obtain the (M/2)^(th) individual to the M^(th) individualin the t^(th)-generation initial mother salp population F^(t):

F _(l) ^(t)=½(Y _(l) ^(t−1) +Y _(l−1) ^(t−1))  (8)

Wherein, Y^(t−1) represents the l^(th) individual in the (t−1)^(th)mother salp population Y^(t−1), Y_(l−1) ^(t−1) represents the (l−1)^(th)individual in the (t−1)^(th) mother salp population Y^(t−1), and F_(l)^(t) represents the l^(th) individual in the t^(th)-generation initialmother salp population F^(t).

S3.5.8: the t^(th)-generation initial mother salp population F^(t) isdeveloped and explored according to formulas (9)-(12) to obtain at^(th)-generation intermediate mother salp population G^(t):

$\begin{matrix}\left\{ \begin{matrix}{\begin{matrix}{{G_{l}^{t} = {F_{A}^{t} - {r3^{t} \times {Levy}^{t} \times \left( {F_{B}^{t} - F_{C}^{t}} \right)}}},} & {\theta < 0}\end{matrix}\ } \\{\begin{matrix}{{G_{l}^{t} = {F_{D}^{t} - {r4^{t} \times {❘{F_{D}^{t} - {2r5^{t} \times F_{l}^{t}}}❘}}}},} & {\theta \geq {0\cap r7^{t}} < {0.5}}\end{matrix}\ } \\{\begin{matrix}\begin{matrix}{{G_{l}^{t} = {\left( {{bP^{t - 1}} - {{mean}\left( F^{t} \right)}} \right) - {r4^{t} \times}}}\ ,} \\\left( {{\left( {{ub} - {lb}} \right) \times r6^{t}} + {lb}} \right)\end{matrix} & {\theta \geq {0\cap r7^{t}} \geq {0.5}}\end{matrix}\ }\end{matrix} \right. & (9)\end{matrix}$ $\begin{matrix}{{Levy}^{t} \sim \frac{\varphi \times \mu^{t}}{{❘v^{t}❘}^{1/\delta}}} & (10)\end{matrix}$ $\begin{matrix}{\varphi = \left\lbrack \frac{{\Gamma\left( {1 + \delta} \right)} \times {\sin\left( {\pi \times {\delta/2}} \right)}}{\Gamma\left( {\left( \frac{\delta + 1}{2} \right) \times \delta \times 2^{{({\delta - 1})}/2}} \right)} \right\rbrack^{1/\delta}} & (11)\end{matrix}$ $\begin{matrix}{\theta = {{\tan\left( {{pi} \times \left( {{r8^{t}} - {0.5}} \right)} \right)} - \left( {1 - {t/T}} \right)}} & (12)\end{matrix}$

Wherein, G_(l) ^(t) represents the l^(th) individual in thet^(th)-generation intermediate mother salp population G^(t) generatedafter updating, Levy^(t) is a step parameter and is expressed byformulas (10)-(11), F_(A) ^(t), F_(B) ^(t), F_(C) ^(t) and F_(D) ^(t)represent four non-repetitive individuals A, B, C, and D randomlyselected from in the t^(th)-generation initial mother salp populationF^(t), r3^(t), r4^(t), r5^(t), r6^(t), r7^(t) and r8^(t) are randomnumbers between 0 and 1 generated by a random function, and μ^(t) is arandom number between 0 and 1 generated by a random function, v^(t) is arandom number following normal distribution and is between 0 and 1, δ isa constant and is set as 1.5, Γ is a standard gamma function, θ is aprobability selection coefficient and is expressed by formula (12), piis π, mean(F^(t)) represents a mean value of the dimension values of theM individuals in the t^(th)-generation initial mother salp populationF^(t), tan represents a tangent function, and sin represents a sinefunction.

S3.5.9: two initial filial salp populations are obtained by using adimension matrix constituted by dimension values of the first column tothe dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as an l^(th)individual of one initial filial salp population and using a dimensionmatrix constituted by dimension values of the (dim+1)^(th) column to the2dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as a l^(th)individual of the other initial filial salp population, and fitnessvalues of the M individuals in the t^(th)-generation initial mother salppopulation F^(t) are obtained by calculation through a method the sameas Step 3.5.1-Step 3.5.4.

Two intermediate filial salp populations are obtained by using adimension matrix constituted by dimension values of the first column tothe dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation intermediate mother salp population G^(t) as a l^(th)individual of one intermediate filial salp population and using adimension matrix constituted by dimension values of the (dim+1)^(th)column to the 2dim^(th) column of the first row of the l^(th) individualin the t¹th-generation intermediate mother salp population G^(t) as al^(th) individual of the other intermediate filial salp population, andfitness values of the M individuals in the t^(th)-generationintermediate mother salp population G^(t) are obtained by calculationthrough a method the same as Step 3.5.1-Step 3.5.4.

The 2 M individuals, including the M individuals in thet^(th)-generation initial mother salp population F^(t) and the Mindividuals in the t^(th)-generation intermediate mother salp populationG^(t), are rearranged in an increasing order according to the fitnessvalues of the 2 M individuals, M individuals with larger fitness valuesare selected, and the M selected individuals are randomly arranged toform a new population.

A maximum fitness value of the new population is compared with theglobal optimum fitness value best; if the maximum fitness value of thenew population is greater than the global optimum fitness value best,the global optimum fitness value best is updated with the maximumfitness value, and the individual corresponding to the maximum fitnessvalue is used as the global optimum individual bestposition; or, if themaximum fitness value of the new population is not greater than theglobal optimum fitness value best, the global optimum fitness value bestand the global optimum individual bestposition are kept unchanged.

Two t^(th)-generation filial salp populations X^(1,t) and X^(2,t) areobtained by using a dimension matrix constituted by dimension values ofthe first column to the dim^(th) column of the first row of the l^(th)individual in the new population as a l^(th) individual of thet^(th)-generation filial salp population X^(1,t) and using a dimensionmatrix constituted by dimension values of the (dim+1)^(th) column to the2dim^(th) column of the first row of the l^(th) individual in the newpopulations a l^(th) individual of the t^(th)-generation filial salppopulation X^(2,t), and the t^(th) iteration is ended.

S6: whether a current value of t is equal to T is determined; if not,the value of t is updated with the sum of the current value of t and 1,and then S3.5.1 is performed to perform a next iteration; if so, theiteration process is ended, the first dimension value to the dim^(th)dimension value of the current global optimum individual bestpositionare used as L thresholds for Renyi entropy-based multi-thresholdsegmentation of the medical image; the L thresholds are arranged in anincreasing order, and then the L thresholds are marked as Th₁, Th₂, Th₃,. . . , Th_(dim); (L+1) segmentation intervals [0, Th₁), [Th₁, Th₂),[Th₂, Th₃), . . . , [Th_(dim), 255] are set, the segmentation intervalinto which the grayscale of each pixel of the medical image I falls isdetermined, the grayscale of the pixel is amended to a lower boundary ofthe corresponding segmentation interval into which the pixels falls, asegmentation grayscale map is obtained based on the amended grayscalesof the pixels of the medical image I after all grayscales of all thepixels of the medical image I are amended, and a finally segmentedmedical image is obtained according to the segmentation grayscale map.

What is claimed is:
 1. A multi-threshold segmentation method for medicalimages based on an improved salp swarm algorithm, comprises thefollowing steps: S1: marking a to-be-segmented medical image as I,marking the size of the to-be-segmented medical image as m×n, marking apixel in the i^(th) row and j^(th) column of the medical image I as(i,j), marking a grayscale of the pixel (i,j) in the medical image I asa_(i,j), and setting the number of thresholds for segmenting the medicalimage as L=20, wherein i=1, 2, . . . , m, and j=1, 2, . . . , n; S2:performing non-local mean filtering on the medical image I to obtain anon-local mean image with the size of m×n, marking a pixel in the i^(th)row and j^(th) column of the non-local mean image as (i_(n),j_(n)), andmarking a grayscale of the pixel (i_(n),j_(n)) in the non-local meanimage as b wherein i_(n)−1, 2, . . . , m, and j_(n)=1, 2, . . . , n;wherein the pixel in the i^(th) row and j^(th) column of the medicalimage I corresponds to the pixel in the i^(th) row and j^(th) column ofthe non-local mean image, and the two pixels constitute a pixel pair;the medical image I corresponds to the non-local mean image to form m×npixel pairs; the grayscales of the two pixels of each pixel pairconstitute a grayscale pair, so that m×n grayscale pairs are obtained; atwo-dimensional histogram is established with the grayscales of thepixels of the medical image I as an x-axis and the grayscales of thepixels of the non-local mean image as a y-axis, wherein coordinates ofthe (i×j)^(th) grayscale pair is (a_(i,j), b_(i) _(n) _(,j) _(n) ), thatis x=a_(i,j), y=b_(i) _(n) _(,j) _(n) , and the number of times ofappearance of the coordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of thegrayscale pair in coordinates of the (i×j) grayscale pairs is marked asf_(i,j), so that the numbers of times of appearance f_(1,1)˜f_(m,n) ofthe coordinates (a_(1,1),b₁ _(n) _(,1) _(n) ) of the first grayscalepair to the coordinates (a_(i,j), b_(i) _(n) _(,j) _(n) ) of the(i×j)^(th) grayscale pair in the coordinates of the (i×j) grayscalepairs are obtained; a joint probability density of the grayscale a_(i,j)of the pixel (i,j) in the medical image I and the grayscale b_(i) _(n)_(,j) _(n) of the pixel (i_(n),j_(n)) in the non-local mean value imageis marked as p(a_(i,j), b_(i) _(n) _(,j) _(n) ), wherein p(a_(i,j),b_(i) _(n) _(,j) _(n) ) is calculated according to formula (1):$\begin{matrix}{{p\left( {a_{i,j},b_{i_{n},j_{n}}} \right)} = \frac{f_{i,j}}{m \times n}} & (1)\end{matrix}$ S3: segmenting the medical image by an improved salp swarmalgorithm, specifically as follows: S3.1: defining a mother salppopulation and two filial salp populations X¹ and X², wherein populationsizes of the mother salp population and the two filial salp populationsX¹ and X² are all M=30, that is, the mother salp population includes Mindividuals, and each filial salp population includes M individuals;each individual in the two filial salp populations is represented by adata matrix constituted by dim=L dimension values in one row and dimcolumns, each individual in the mother salp population is represented bya data matrix constituted by 2dim=L dimension values in one row and 2dimcolumns, and the data matrices are called dimension matrices; a lowerboundary matrix of the mother salp population is set as lb, and an upperboundary matrix of the mother salp population is set as ub, wherein, lbis a matrix [0, 0, 0, . . . , 0] including one row and 2dim columns, ubis a matrix [254, 254, 254, . . . , 254] including one row and 2dimcolumns, lb_(D) represents the D^(th) element in the lower boundarymatrix lb, ub_(D) represents the D^(th) element in the upper boundarymatrix ub, and D=1, 2, . . . , 2dim; S3.2: initializing the filial salppopulation X¹ and the filial salp population X² respectively to obtain0-generation filial salp populations X^(1,0) and X^(2,0), specificallyas follows: S3.2.1: assigning each individual in the filial salppopulation X¹ and each individual in the filial salp population X²respectively according to formula (2) and formula (3):X _(l,d) ¹=rand *(ub _(d) −lb _(d))+lb _(d)  (2)X _(l,d) ²=rand *(ub _(d) −lb _(d))+lb _(d)  (3) wherein, lb_(d)represents the d^(th) element in the lower boundary matrix lb, ub_(d)represents the d^(th) element in the upper boundary matrix ub, and d=1,2, . . . , dim; X_(l,d) ¹ represents the d^(th) dimension value of thel^(th) individual in the filial salp population X¹, X_(l,d) ² representsthe d^(th) dimension value of the l^(th) individual in the filial salppopulation X², and l=1, 2, . . . , 30; rand represents a random numberbetween 0 and 1 generated by a random function, and rand is regeneratedby the random function before each calculation performed according toformula (2) and formula (3); S3.2.2: rearranging the dimensional valuesof each assigned individual in the filial salp population X¹ in anincreasing order to obtain a 0-generation salp population X^(1,0),marking the d^(th) dimension value of the l^(th) individual in the0-generation salp population X^(1,0), as X_(l,d) ^(1,0), rearranging thedimensional values of each assigned individual in the filial salppopulation X² in an increasing order to obtain a 0-generation salppopulation X^(2,0), marking the d^(th) dimension value of the l^(th)individual in the 0-generation salp population X^(2,0), as X_(l,d)^(2,0); S3.3: setting a global optimum fitness value best, initiallyassigning best with a minus infinity, setting a global optimumindividual bestposition, and initially setting bestposition as a matrix[0, 0, 0, . . . , 0] including one row and 2dim columns; S3.4: setting amaximum number of iterations of the mother salp population as T=100,setting an iteration variable t, and initially setting t as 1; S3.5:performing a t^(th) iteration on the mother salp population,specifically as follows: S3.5.1: setting two threshold vectors h^(l,t)∧s^(l,t) capable of storing one row and (L−1) columns of data, roundingoff the first dimension value to the (L−1)^(th) dimension value of thel^(th) individual in the (t−1)^(th)-generation filial salp populationX¹,t−1 to obtain integers which are put into h^(l,t), and marking H^(th)data in h^(l,t) as h_(H) ^(l,t), wherein H=1, 2, . . . , (L−1); roundingoff the first dimension value to the (L−1)^(th) dimension value of thel^(th) individual in the (t−1)^(th)-generation filial salp populationX^(2,t−1) to obtain integers which are put into s^(l,t), and markingH^(th) data in s^(l,t) as s t, and constituting a threshold vector(h_(H) ^(l,t),s_(H) ^(l,t)) by h_(H) ^(l,t) and s_(H) ^(l,t), so that(L−1) pairs of threshold vectors are obtained; segmenting the medicalimage I into L regions, which are [0,h₁ ^(l,t), [h₁ ^(l,t), h₂ ^(l,t), .. . , [h_(L−1) ^(l,t), h_(L−1) ^(l,t) and [h_(L−1) ^(l,t),255respectively, according to h^(l,t) pairs of grayscales of the medicalimage I in the two-dimensional histogram, wherein [represents theinclusion of a lower boundary, and the exclusion of an upper boundary;segmenting the medical image I into L regions, which are [0,s₁ ^(l,t),[s₁ ^(l,t),s₂ ^(l,t), . . . , [s_(L−2) ^(l,t),s_(L−1) ^(l,t) and[s_(L−1) ^(l,t),255 respectively, according to s^(l,t) pairs ofgrayscales of the medical image I in the two-dimensional histogram,forming L grayscale pair segmentation regions {N₁, N₂ . . . N_(L)} bythe L regions obtained by segmentation according to the grayscales ofthe medical image I in the two-dimensional histogram and L regionsobtained by segmentation according to grayscales of the non-local meanimage in the two-dimensional histogram, representing the probability ofappearance of the kth grayscale pair segmentation region N_(k) by I_(N)_(k) (h_(k) ^(l,t),s_(k) ^(l,t)), and marking a Kapur entropy of thecurrent kth grayscale pair segmentation region N_(k) as K_(N) _(k)^(t)(h_(k) ^(l,t),s_(k) ^(l,t)), wherein k=1, 2, . . . , (L−1), and theKapur entropy K_(N) _(k) ^(t)(h_(k) ^(l,t),s_(k) ^(l,t)) is expressed byformula (4): $\begin{matrix}\left\{ \begin{matrix}{{K_{N_{k}}^{t}\left( {h_{k}^{l,t},s_{k}^{l,t}} \right)} = {- {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{\frac{p\left( {g,b} \right)}{w_{L - 1}}\ln\frac{p\left( {g,b} \right)}{w_{L - 1}}}}}}} \\{w_{L - 1} = {\sum\limits_{g = h_{k - 1}^{l,t}}^{h_{k}^{l,t}}{\sum\limits_{b = s_{k - 1}^{l,t}}^{s_{k}^{l,t}}{p\left( {g,b} \right)}}}}\end{matrix} \right. & (4)\end{matrix}$ Wherein, when k=1, s₀ ^(l,t)=0, h₀ ^(l,t)=0, g is aninteger, g=0, 1, . . . , h_(k) ^(l,t), b is an integer, and b=0, 1, . .. , s_(k) ^(l,t); and when the value of (g,b) is not within the m×ngrayscale pairs obtained in S2, p(g,b)=0; In represents a naturallogarithm; S3.5.2: obtaining a (t−1)^(th) mother salp population Y^(t−1)by using the dimension values of one row and dim columns of the l^(th)individual of the (t−1)^(th)-generation filial salp population X^(1,t−1)as dimension values from the first column to the dim^(th) column of thefirst row of the mother salp population and using the dimension valuesof one row and dim columns of the (t−1)^(th)-generation filial salppopulation X^(2,t−1) as dimension values from the (dim+1)^(th) column tothe 2dim^(th) column of the first row of the mother salp population, andmarking the D^(th) dimension value of the l^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) as Y_(l,D) ^(t−1), whereinD=1, 2, . . . , 2dim; S3.5.3: setting an objective function of thel^(th) individual in the (t−1)^(th) mother salp population Y^(t−1) asR^(l,t−1){(h₁ ^(l,t),s₁ ^(l,t)),(h₂ ^(l,t),s₂ ^(l,t)), . . . (h_(L−1)^(l,t),s_(L−1) ^(l,t))}, and expressing the objective function byformula (5): $\begin{matrix}{{R^{l,{t - 1}}\left\{ {\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right),\ \left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right),{\ldots\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}} \right\}} = {{K_{N_{1}}^{t}\left( {h_{1}^{l,t},\ s_{1}^{l,t}} \right)} + {K_{N_{2}}^{t}\left( {h_{2}^{l,t},\ s_{2}^{l,t}} \right)} + \ldots + {K_{N_{L - 1}}^{t}\left( {h_{L - 1}^{l,t},s_{L - 1}^{l,t}} \right)}}} & (5)\end{matrix}$ S3.5.4: substituting the Kapur entropy K_(N) _(k) (h_(k)^(l,t),s_(k) ^(l,t)) of the current kth grayscale pair segmentationregion N_(k) obtained by calculation into the objective function of thel^(th) individual in the (t−1)^(th) mother salp population Y^(t−1) toobtain an objective function value of the l^(th) individual in the(t−1)^(th) mother salp population Y^(t−1) by calculation, and using theobjective function value as a fitness value fitness (l)^(t−1) of thel^(th) individual in the (t−1)^(th) mother salp population Y^(t−1), sothat the fitness values of M individuals in the (t−1)^(th) mother salppopulation Y^(t−1) are obtained by calculation; S3.5.5: rearranging thefitness values of the M individuals in the (t−1)^(th) mother salppopulation Y^(t−1) in an increasing order, marking a maximum fitnessvalue of the (t−1)^(th) mother salp population Y^(t−1) as bF^(t−1),marking a minimum fitness value of the (t−1)^(th) mother salp populationY^(t−1) as wF^(t−1), marking the individual corresponding to the maximumfitness value as bP^(t−1), and using the individual corresponding to themaximum fitness value as an optimum individual of the (t−1)^(th) mothersalp population Y^(t−1); S3.5.6: updating the first individual to the(M/2)^(th) individual in the (t−1)^(th) mother salp population Y^(t−1)according to formula (6) to obtain a first individual to an (M/2)^(th)individual in a t^(th)-generation initial mother salp population F^(t):$\begin{matrix}{F_{l,D}^{t} = \left\{ \begin{matrix}{{{bP_{D}^{t - 1}} + {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} \geq 0} \\{{{bP_{D}^{t - 1}} - {{c^{t}\left( {{\left( {{ub_{D}} - {lb_{D}}} \right)r1^{t}} + {lb_{D}}} \right)}r2^{t}}} < 0}\end{matrix} \right.} & (6)\end{matrix}$ $\begin{matrix}{c^{t} = {2e^{- {(\frac{4*t}{T})}^{2}}}} & (7)\end{matrix}$ wherein, r1^(t) and r2^(t) represent random numbersbetween 0 and 1 generated by a random function, c^(t) is a controlparameter and is expressed by formula (7), bP_(D) ^(t−1) represents theD^(th) dimension value of the optimum individual of the (t−1)^(th)mother salp population Y^(t−1), F_(l,D) ^(t) represents the D^(th)dimension value of the l^(th) individual in the t^(th)-generationinitial mother salp population F^(t), ub_(D) and lb_(D) represent theD^(th) dimension value of an upper boundary and the D^(th) dimensionvalue of a lower boundary, and e is a natural constant; S3.5.7: updatingthe (M/2)^(th) individual to the M^(th) individual in the (t−1)^(th)mother salp population Y^(t−1) according to formula (8) to obtain the(M/2)^(th) individual to the M^(th) individual in the t^(th)-generationinitial mother salp population F^(t):F _(l) ^(t)=½(Y _(l) ^(t−1) +Y _(l−1) ^(t−1))  (8) wherein, Y_(l) ^(t−1)represents the l^(th) individual in the (t−1)^(th) mother salppopulation Y^(t−1), Y_(l−1) ^(t−1) represents the (l−1)^(th) individualin the (t−1)^(th) mother salp population Y^(t−1), and F_(l) representsthe l^(th) individual in the t^(th)-generation initial mother salppopulation F^(t); S3.5.8: developing and exploring the t^(th)-generationinitial mother salp population F^(t) according to formulas (9)-(12) toobtain a t^(th)-generation intermediate mother salp population G^(t):$\begin{matrix}\left\{ \begin{matrix}{\begin{matrix}{{G_{l}^{t} = {F_{A}^{t} - {r3^{t} \times {Levy}^{t} \times \left( {F_{B}^{t} - F_{C}^{t}} \right)}}},} & {\theta < 0}\end{matrix}\ } \\{\begin{matrix}{{G_{l}^{t} = {F_{D}^{t} - {r4^{t} \times {❘{F_{D}^{t} - {2r5^{t} \times F_{l}^{t}}}❘}}}},} & {\theta \geq {0\cap r7^{t}} < {0.5}}\end{matrix}\ } \\{\begin{matrix}\begin{matrix}{{G_{l}^{t} = {\left( {{bP^{t - 1}} - {{mean}\left( F^{t} \right)}} \right) - {r4^{t} \times}}}\ ,} \\\left( {{\left( {{ub} - {lb}} \right) \times r6^{t}} + {lb}} \right)\end{matrix} & {\theta \geq {0\cap r7^{t}} \geq {0.5}}\end{matrix}\ }\end{matrix} \right. & (9)\end{matrix}$ $\begin{matrix}{{Levy}^{t} \sim \frac{\varphi \times \mu^{t}}{{❘v^{t}❘}^{1/\delta}}} & (10)\end{matrix}$ $\begin{matrix}{\varphi = \left\lbrack \frac{{\Gamma\left( {1 + \delta} \right)} \times {\sin\left( {\pi \times {\delta/2}} \right)}}{\Gamma\left( {\left( \frac{\delta + 1}{2} \right) \times \delta \times 2^{{({\delta - 1})}/2}} \right)} \right\rbrack^{1/\delta}} & (11)\end{matrix}$ $\begin{matrix}{\theta = {{\tan\left( {{pi} \times \left( {{r8^{t}} - {0.5}} \right)} \right)} - \left( {1 - {t/T}} \right)}} & (12)\end{matrix}$ wherein, G_(l) ^(t) represents the l^(th) individual inthe t^(th)-generation intermediate mother salp population G^(t)generated after updating, Levy^(t) is a step parameter and is expressedby formulas (10)-(11), F_(A) ^(t), F_(B) ^(t), F_(C) ^(t) and F_(D) ^(t)represent four non-repetitive individuals A, B, C and D randomlyselected from in the t^(th)-generation initial mother salp populationF^(t), r3^(t), r4^(t), r5^(t), r6^(t), r7^(t) and r8^(t) are randomnumbers between 0 and 1 generated by a random function, and μ^(t) is arandom number between 0 and 1 generated by a random function, v^(t) is arandom number following normal distribution and is between 0 and 1, δ isa constant and is set as 1.5, Γ is a standard gamma function, θ is aprobability selection coefficient and is expressed by formula (12), piis π, mean(F^(t)) represents a mean value of the dimension values of theM individuals in the t^(th)-generation initial mother salp populationF^(t), tan represents a tangent function, and sin represents a sinefunction; S3.5.9: obtaining two initial filial salp populations by usinga dimension matrix constituted by dimension values of the first columnto the dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as an l^(th)individual of one initial filial salp population and using a dimensionmatrix constituted by dimension values of the (dim+1)^(th) column to the2dim^(th) column of the first row of the l^(th) individual in thet^(th)-generation initial mother salp population F^(t) as a l^(th)individual of the other initial filial salp population, and obtainingfitness values of the M individuals in the t^(th)-generation initialmother salp population F^(t) by calculation through a method the same asStep 3.5.1-Step 3.5.4; obtaining two intermediate filial salppopulations by using a dimension matrix constituted by dimension valuesof the first column to the dim^(th) column of the first row of thel^(th) individual in the t^(th)-generation intermediate mother salppopulation G t as a l^(th) individual of one intermediate filial salppopulation and using a dimension matrix constituted by dimension valuesof the (dim+1)^(th) column to the 2dim^(th) column of the first row ofthe l^(th) individual in the t^(th)-generation intermediate mother salppopulation G^(t) as a l^(th) individual of the other intermediate filialsalp population, and obtaining fitness values of the M individuals inthe t^(th)-generation intermediate mother salp population G^(t) bycalculation through a method the same as Step 3.5.1-Step 3.5.4;rearranging the 2 M individuals, including the M individuals in thet^(th)-generation initial mother salp population F^(t) and the Mindividuals in the t^(th)-generation intermediate mother salp populationG^(t), in an increasing order according to the fitness values of the 2 Mindividuals, selecting M individuals with larger fitness values, andrandomly arranging the M selected individuals to form a new population;comparing a maximum fitness value of the new population with the globaloptimum fitness value best; if the maximum fitness value of the newpopulation is greater than the global optimum fitness value best,updating the global optimum fitness value best with the maximum fitnessvalue, and using the individual corresponding to the maximum fitnessvalue as the global optimum individual bestposition; or, if the maximumfitness value of the new population is not greater than the globaloptimum fitness value best, keeping the global optimum fitness valuebest and the global optimum individual bestposition unchanged; obtainingtwo t^(th)-generation filial salp populations X^(1,t) and X^(2,t) byusing a dimension matrix constituted by dimension values of the firstcolumn to the dim^(th) column of the first row of the l^(th) individualin the new population as a l^(th) individual of the t^(th)-generationfilial salp population X^(1,t) and using a dimension matrix constitutedby dimension values of the (dim+1)^(th) column to the 2dim^(th) columnof the first row of the l^(th) individual in the new population as al^(th) individual of the t^(th)-generation filial salp populationX^(2,t), and ending the t^(th) iteration; S6: determining whether acurrent value of t is equal to T; if not, updating the value of t withthe sum of the current value of t and 1, and then returning to S3.5.1 toperform a next iteration; if so, ending the iteration process, using thefirst dimension value to the dim^(th) dimension value of the currentglobal optimum individual bestposition as L thresholds for Renyientropy-based multi-threshold segmentation of the medical image;arranging the L thresholds in an increasing order, and then marking theL thresholds as Th₁, Th₂, Th₃, . . . , Th_(dim); setting (L+1)segmentation intervals [0, Th₁), [Th₁, Th₂), [Th₂, Th₃), . . . ,[Th_(dim), 255], determining the segmentation interval into which thegrayscale of each pixel of the medical image I falls, amending thegrayscale of the pixel to a lower boundary of the correspondingsegmentation interval into which the pixels falls, obtaining asegmentation grayscale map based on the amended grayscales of the pixelsof the medical image I after all grayscales of all the pixels of themedical image I are amended, and obtaining a finally segmented medicalimage according to the segmentation grayscale map.